#ifndef ORBIT_CAMERA_HPP
#define ORBIT_CAMERA_HPP

#include <Ogre.h>

#include <OISMouse.h>

class OrbitCamera
{
	public: 
		
		OrbitCamera();
		~OrbitCamera();

		// Camera functions.
		void createOrbitCamera(Ogre::SceneManager* i_pSceneMgr, Ogre::SceneNode* i_pFollowNode, Ogre::Camera* i_pCamera, OIS::Mouse* i_pMouse);
		
		// THESE FUNCTIONS MUST BE ADDED TO THEIR RESPECTIVE FUNCTIONS 
		// WHEREVER THIS GETS ADDED.
		void updateOrbitCamera(double timeSinceLastFrame);
		void injectMouseButtonDown(const OIS::MouseButtonID& id);
		void injectMouseButtonRelease(const OIS::MouseButtonID& id);

	private:

		// Set functions.
		void setFollowNode(Ogre::SceneNode* i_pFollowNode);
		void setCamera(Ogre::Camera* i_pCamera);
		void OrbitCamera::setSceneManager(Ogre::SceneManager* i_pSceneMgr);
		
		// Separate function for setting mouse related camera movement.
		void setCameraOrientationAndDistance(double timeSinceLastFrame);

		// Pointer used to handle unbuffered mouse input.
		OIS::Mouse* m_pMouse;

		// Pointer to the SceneManager we are operating in.
		Ogre::SceneManager*	m_pSceneMgr;

		// Pointer to the SceneNode that the camera follows.
		Ogre::SceneNode*	m_pFollowNode;
		Ogre::SceneNode*	m_pPositionNode;

		// Pointer to the Camera that this manager uses.
		Ogre::Camera*		m_pCamera;

		// Whether or not rotations of the camera are allowed.
		bool				m_bIsCameraRotationAllowed;
		Ogre::Real			m_fDistanceToPositionNode;

		// Variables used for rotations.
		float				m_fPitchVelocity;
		float				m_fPitchOldVelocity;
		float				m_fYawVelocity;
		float				m_fYawOldVelocity;
		float				m_fZoomVelocity;
		float				m_fZoomOldVelocity;

		float				m_fPitchAccel;
		float				m_fYawAccel;
		float				m_fZoomAccel;

		// Multipliers and constants used for camera rotations.
		float				m_fZoomMultiplier;
		float				m_fRotationMultiplier;
		float				m_fDragAccel;
		float				m_fRotationTopSpeed;
	
};

#endif